﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//
//
public class MyClass15<T> {

    private T[] m_array;
    public MyClass15(int size)
    {
        m_array = new T[size];
    }
    public void Set(int index,T value)
    {
        m_array[index] = value;
    }
    public T Get(int index)
    {
        return m_array[index];
    }
}
public class MyClasstype {

    public int a;
    public MyClasstype(int value)
    {
        this.a = value;
    }
    public void Show<T>(T A)
    {
        Debug.Log("A:" + A);
    }
}
public class TClass : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        //MyClass15 myClass15 = new MyClass15(5);
        //myClass15.Set(0, 1);
        //myClass15.Set(1, 2);
        //int a = myClass15.Get(0);
        //int b = myClass15.Get(1);
        //Debug.LogFormat("第{0}号位，值：{1}", 0, a);
        //Debug.LogFormat("第{0}号位，值：{1}",1, b);


        //MyClass15<string> myClass = new MyClass15<string>(5);
        //myClass.Set(0, "LIu");
        //myClass.Set(1, "Bai");
        //string a = myClass.Get(0);
        //string b = myClass.Get(1);
        //Debug.LogFormat("第{0}号位，值：{1}", 0, a);
        //Debug.LogFormat("第{0}号位，值：{1}",1, b);

        //MyClass15<MyClasstype> myClass1 = new MyClass15<MyClasstype>(5);
        //myClass1.Set(0, new MyClasstype(1));
        //myClass1.Set(1, new MyClasstype(2));
        //MyClasstype a1 = myClass1.Get(0);
        //MyClasstype b1 = myClass1.Get(1);
        //Debug.LogFormat("第{0}号位，值：{1}", 0, a1.a);
        //Debug.LogFormat("第{0}号位，值：{1}", 1, b1.a);
        MyClasstype myClasstype = new MyClasstype(5);
        myClasstype.Show<string>("1245");
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
